package com.evil.mi.dao;

import com.evil.mi.entity.AlternativeVideoEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

/**
 * com.evil.mi.dao
 *
 * @author 白雨浓
 * date: 2018/8/21 17:25
 * content:
 */
@Repository
public interface AlternativeVideoRepository extends JpaRepository<AlternativeVideoEntity, Integer> {

    @Modifying
    @Transactional
    @Query(value = "DELETE FROM alternative_video WHERE video_id = :videoId", nativeQuery = true)
    void deleteByVideoId(@Param("videoId") int videoId);

}
